#include<stdio.h>
#define max 100000l
long c[106][108],trace[106][106];
int n,m,k;
void init(){
    int i,j;
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            c[i][j]=(i==j)?0:100000;
            trace[i][j]=j;
        }
    }
}
void floyd(){
    int u,v,k;
    for(k=1;k<=n;k++)
        for(u=1;u<=n;u++)
            for(v=1;v<=n;v++)
                if(c[u][v]>c[u][k]+c[v][k]){
                    c[u][v]=c[u][k]+c[v][k];
                    trace[u][v]=trace[u][k];
                }
}
void process(){
    int i,j,u,v,l;
    int enter=0;
    int arr[100],id;
    FILE *fp=stdin;
    fscanf(fp,"%d%d%d",&n,&m,&k);
    init();
    for(i=1;i<=m;i++){
        fscanf(fp,"%d%d%d",&u,&v,&l);
        c[u][v]=c[v][u]=l;
    }
    floyd();
    for(i=1;i<=k;i++){
        fscanf(fp,"%d%d%d",&l,&u,&v);
        if(i>1)printf("\n");
        if(l==0)printf("%ld",c[u][v]);
        else{
            id=1;
            arr[id]=u;
            do{
                u=trace[u][v];
                arr[++id]=u;
            }while(u!=v);
            printf("%d",id);
            for(j=1;j<=id;j++)printf(" %d",arr[j]);
        }
    }
}
int main(){
    process();
    return 0;
}
